<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/component/common.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" ></meta>
    <title>详细内容</title>
    <script src="${assets}/js/views/vue.min.js"></script>
    <link rel="stylesheet" href="${frames}/css/lib/bootstrap.min.css" type="text/css" type="text/css">
    <link rel="stylesheet" href="${newframe}/css/base/base.css" type="text/css">
    <link rel="stylesheet" href="${newframe}/css/common.css" type="text/css">
    <%@ include file="/WEB-INF/jsp/component/commonBottom.jsp" %>
    <link rel="stylesheet" href="${assets}/css/views/department/addDepartment.css">
    <link rel="stylesheet" href="${assets}/css/select-bootstrap.css">
    <script src="${assets}/js/select-bootstrap.js"></script>
    <%--<script src="../assets/js/views/cleanInput.js"></script>--%>
    <style>
        *{
            padding:0;
            list-style: none;
            text-decoration: none;
            font-weight:100;
            font-family:"微软雅黑";
        }
        span,label{
            font:17px/33px '微软雅黑';
            display:inline-block;
        }
        h3{
            font:16px/30px '微软雅黑';
            color:black;
        }
        body{
            width:98%;
            margin:0 auto;
            height:100%;
        }
        /*内容信息*/
        .img{
            width:170px;
            display:inline-block;
        }
        .form{
            display:inline-block;
            height:150px;
            overflow-y:scroll;
            overflow-x:hidden;
            width:600px;
        }
        .form label{
            width:125px;
        }
        .form div{
            margin:10px 0;
        }
        .form input{
            width:250px;
        }
        .btn-group{
            width:250px !important;
            height:32px !important;
        }
        .dropdown-toggle{
            margin-top:0px !important
        }
        .btn-group button{
            padding:0 !important
        }
        input{
            border:1px solid #d0d0d0;
            font:15px/30px '微软雅黑';
            color:black;
            text-indent:1rem;
        }
        .modal-body{
            height: auto !important
        }
        #keep{
            background:#35acfd !important;
        }
        .change{
            width:100%;
        }
        .btn-active {
            width: 100px;
            line-height: 15px;
            background: #35acfd;
            color: white;
            margin-top:15px;
        }
        .modal-footer{
            width:255px;
            margin:0 auto;
        }
        .content{
            width:90%;
            margin:0 auto;
            overflow:hidden;
        }
        input{
            border: solid 1px #d0d0d0;
            width:250px !important;
            height:32px !important;
            vertical-align:middle;
            display:inline-block !important;
        }
        .defualt{
            border:1px solid red !important;
        }
        input::-webkit-input-placeholder{
            color:red;
        }
        input::-moz-placeholder{   /* Mozilla Firefox 19+ */
            color:red;
        }
        input:-moz-placeholder{    /* Mozilla Firefox 4 to 18 */
            color:red;
        }
        input:-ms-input-placeholder{  /* Internet Explorer 10-11 */
            color:red;
        }
        .positionDiv{
            position:relative;
            height:35px;
        }
    </style>
</head>
<body>
<div style="width:100%;overflow:hidden;">
    <div class="header">
        <h1>病人身份证号修改</h1>
    </div>
    <div class="content" id="main">
        <div class="form">
            <form>
                <div>
                    <label for="newIdcard"><h3>新身份证</h3></label>
                    <input type="text" maxlength="18" class="form-control" id="newIdcard" placeholder="请输入新的身份证号">
                </div>
                <div>
                    <label for="newIdcardTwo"><h3>确认新身份证</h3></label>
                    <input type="text" maxlength="18" class="form-control" id="newIdcardTwo" placeholder="请重新输入新的身份证号">
                </div>
            </form>
            <span class="errorTip" style="width:80%;color:red;font-size:16px;text-align: center;display:none;"></span>
        </div>
        <div class="form-group submitBtn" style="text-align: center ">
            <button type="button" class="btn-active btn" data-dismiss="modal" id="closeModalButt" onclick="closeFrame()">
                关闭
            </button>
            <button type="submit" class="btn-active btn" id="keep" onclick="keep()" style="margin-left:20px;">保存</button>
        </div>
    </div>
</div>
<script>
  var diseasesType = ''
  var urlLib = ''
  var refreshto = ''
  $(document).ready(function(){
    var url = location.search.split('?')
    $.ajax({
      url:"${URL_SCREENING_GETBREADLINE}",
      dataType:'json',
      type:'post',
      success:function(data){
        urlLib = JSON.parse(data.data)
        refreshto = urlLib[urlLib.length-1].href
      }
    })
  })
  function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return null;
  }
  //关闭并刷新
  function closeFrame() {
    window.parent.simpleCloseModal();
  }
  function keep(){
    // 获取当前所哟u input 中的数据
    // 获取身份证
    var oldIdcard = getQueryString('idcard');
    var newIdcard = $("#newIdcard").val();
    // 获取病人姓名
    var newIdcardTwo = $("#newIdcardTwo ").val();
    if(newIdcard == '' || newIdcard == undefined || newIdcard == null){
      $('.errorTip').css('display','block');
      $('.errorTip').html('请输入新身份证！');
      return
    }else if(newIdcard.length < 18){
      $('.errorTip').css('display','block');
      $('.errorTip').html('请输入正确的18位新身份证！');
      return
    }
    if(newIdcardTwo == '' || newIdcardTwo == undefined || newIdcardTwo == null){
      $('.errorTip').css('display','block');
      $('.errorTip').html('请输入确认新身份证！');
      return
    }else if(newIdcardTwo.length < 18){
      $('.errorTip').css('display','block');
      $('.errorTip').html('请确认输入正确的18位新身份证！');
      return
    }
    // 获取身高参数
    if(newIdcard == newIdcardTwo ){
      alert('确定修改身份证！！')
      $.ajax({
        url : "${ctx}/pppatientbase/update/idCard",
        dataType:"json",
        type:"post",
        data:{
          oldIdCard:oldIdcard,
          newIdCard:newIdcard
        },
        success:function( data ){
          if( data.code == 0 ) {
            // 刷新当前页面
            parent.showSrc('${ctx}/boneLoose/qianhu/detail?idCard=' + newIdcard + '&diseasesType=5');
            window.parent.simpleCloseModal();
          }else{
            alert(data.msg);
            window.parent.simpleCloseModal();
          }
        }
      })
      }else{
        $('.errorTip').css('display','block');
        $('.errorTip').html('两次输入的号码不一样，请重新输入！');

      }
      // 获取体重参数

      <%--if( $('#name').val() === '' ){--%>
    <%--  if( $('#name').hasClass('defualt') ){--%>

    <%--  }else{--%>
    <%--    $('#name').addClass('defualt')--%>
    <%--    $('#name').focus()--%>
    <%--    $('#name').attr('placeholder','请输入姓名')--%>
    <%--  }--%>
    <%--}else{--%>
    <%--  $.ajax({--%>
    <%--    url : "${URL_PATIENT_UPDATEPATIENT}",--%>
    <%--    dataType:"json",--%>
    <%--    type:"post",--%>
    <%--    data:{--%>
    <%--      id:'${entity.id}',--%>
    <%--      realname:realname,--%>
    <%--      idcard:idcard,--%>
    <%--      phone:phone,--%>
    <%--      height:height,--%>
    <%--      weight:weight,--%>
    <%--      waist:waist,--%>
    <%--      contactphone:contactphone,--%>
    <%--      homeaddress:address,--%>
    <%--      diseaseDiagnosis:diseaseDiagnosis,--%>
    <%--      diseasesType:diseasesType,--%>
    <%--      remark:remark--%>
    <%--    },--%>
    <%--    success:function( data ){--%>
    <%--      console.log(data)--%>
    <%--      if( data.success ){--%>
    <%--        // 刷新当前页面--%>
    <%--        parent.showSrc(refreshto)--%>
    <%--        window.parent.simpleCloseModal();--%>
    <%--      }else if( !data.success ){--%>
    <%--        alert(data.msg)--%>
    <%--      }--%>
    <%--    }--%>
    <%--  })--%>
    <%--}--%>
  }
</script>
</body>
</html>
